//
//  VideosdetailViewController.m
//  糗事-1
//
//  Created by wl on 15/3/30.
//  Copyright (c) 2015年 apple. All rights reserved.
//

#import "VideosdetailViewController.h"
//#import "Videos.h"
#import "MovieData.h"
@interface VideosdetailViewController ()

@end

@implementation VideosdetailViewController
- (void)dealloc
{
    [_data release];
    [_player release];
    [super dealloc];
}
-(void)aa
{
    [self.navigationController popViewControllerAnimated:YES];
    [self.player stop];
}



- (void)viewDidLoad {
    [super viewDidLoad];
    //UIBarButtonItem *item=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemReply target:self action:@selector(aa)];
    UIImage *image1 = [[[UIImage alloc]init]autorelease];
    image1 = [UIImage imageNamed:@"BarButton"];
    
    UIButton *BarButton = [UIButton buttonWithType:UIButtonTypeCustom];
    BarButton.frame = CGRectMake(0, 0, 20, 20);
    [BarButton setImage:image1 forState:UIControlStateNormal];
    [BarButton addTarget:self action:@selector(aa) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem *button = [[[UIBarButtonItem alloc]initWithCustomView:BarButton]autorelease];
    self.navigationItem.leftBarButtonItem=button;
  
    [self play1];
    
}
-(void)play1
{
    
    //本地文件播放
   // _player=[[MPMoviePlayerController alloc]initWithContentURL:[[NSBundle mainBundle]URLForResource:@"promo_full.mp4" withExtension:nil]];
//    _player=[[MPMoviePlayerController alloc]initWithContentURL:[NSURL URLWithString:self.vid.vplay_url]];
    _player = [[MPMoviePlayerController alloc]initWithContentURL:[NSURL URLWithString:self.data.videouri]];
 _player.view.frame=self.view.bounds;
  

    _player.view.autoresizingMask=UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;//横竖屏 时自动调整视图大小
    [self.view addSubview:_player.view];
     [self.player play];
    [self.player stop];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
